HAL GFXMMU types migration

This section provides information about the HAL GFXMMU types migration.

HAL GFXMMU address cache type definition

HAL1

HAL2

In HAL1, this structure is used with :

  • the GFXMMU_InitTypeDef structure and HAL_GFXMMU_Init function : to enable or disable the address cache with providing the buffer on which the address cache is locked.

  • the HAL_GFXMMU_ModifyAddressCache function: to change the address cache settings already configured in HAL_GFXMMU_Init.

In HAL2, the address cache is enabled or disabled by unitary functions in the HAL layer.

hal_gfxmmu_buff_t buff is to select the buffer index

typedef struct
{
  FunctionalState Activation;


  uint32_t AddressCacheLockBuffer;


 } GFXMMU_AddressCacheTypeDef;


hal_status_t HAL_GFXMMU_EnableCache(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisableCache(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu,
                                            hal_gfxmmu_buff_t buff);
hal_status_t HAL_GFXMMU_DisableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu);

For more details see HAL GFXMMU modify the address cache configuration and HAL GFXMMU initialization type definition


HAL GFXMMU buffers addresses type definition

HAL1

HAL2

typedef struct
{
  uint32_t Buf0Address;
  uint32_t Buf1Address;
  uint32_t Buf2Address;
  uint32_t Buf3Address;
 } GFXMMU_BuffersTypeDef;
hal_status_t HAL_GFXMMU_SetBuffPhysicalAddr(hal_gfxmmu_handle_t *hgfxmmu,
                                            hal_gfxmmu_buff_t buff,
                                            uint32_t buff_physical_addr);

hal_gfxmmu_buff_t is to select the buffer index.

buff_physical_addr is to provide the physical address to the selected buffer.

For more details see HAL GFXMMU modify buffer configurations


HAL GFXMMU cache and prefetch type definition

HAL1

HAL2

typedef struct
 {
   FunctionalState Activation;
   uint32_t CacheLock;


   uint32_t CacheLockBuffer;



   uint32_t CacheForce;


   uint32_t Prefetch;





   uint32_t OutterBufferability;
   uint32_t OutterCachability;

 } GFXMMU_CachePrefetchTypeDef;



hal_status_t HAL_GFXMMU_EnableCache(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisableCache(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu,
                                            hal_gfxmmu_buff_t buff);
hal_status_t HAL_GFXMMU_DisableCacheLockBuff(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnableForceCache(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisableForceCache(hal_gfxmmu_handle_t *hgfxmmu);

hal_status_t HAL_GFXMMU_EnablePrefetch(hal_gfxmmu_handle_t *hgfxmmu);
hal_status_t HAL_GFXMMU_DisablePrefetch(hal_gfxmmu_handle_t *hgfxmmu);


typedef struct
{
  hal_gfxmmu_outer_bufferability_t outer_bufferability;
  hal_gfxmmu_outer_cachability_t outer_cachability;
} hal_gfxmmu_cache_config_t;

HAL GFXMMU handle type definition

HAL1

HAL2

GFXMMU_HandleTypeDef
hal_gfxmmu_handle_t

Related concept:


HAL GFXMMU initialization type definition

HAL1

HAL2

In HAL1, GFXMMU_InitTypeDef structure is a member of GFXMMU_HandleTypeDef structure using in the HAL_GFXMMU_Init function.

IN HAL2, this structure is split to hal_gfxmmu_config_t structure and unitary functions in the HAL layer.

typedef struct
 {
   uint32_t BlocksPerLine;


   uint32_t DefaultValue;


   GFXMMU_BuffersTypeDef Buffers;






   #if defined(GFXMMU_CR_CE)


   GFXMMU_CachePrefetchTypeDef CachePrefetch;


   #endif /* GFXMMU_CR_CE */


   #if defined(GFXMMU_CR_ACE)

   GFXMMU_AddressCacheTypeDef  AddressCache;


   #endif /* GFXMMU_CR_ACE */


   GFXMMU_InterruptsTypeDef Interrupts;


 } GFXMMU_InitTypeDef;
typedef struct
{
  hal_gfxmmu_block_per_line_t blocks_per_line;
} hal_gfxmmu_config_t;

hal_status_t HAL_GFXMMU_SetDefaultReturnVal(hal_gfxmmu_handle_t *hgfxmmu,
                                           uint32_t val);

hal_status_t HAL_GFXMMU_SetBuffPhysicalAddr(hal_gfxmmu_handle_t *hgfxmmu,
                                           hal_gfxmmu_buff_t buff,
                                           uint32_t buff_physical_addr);

Members changed

#if defined(GFXMMU_CR_CE)

For more details see HAL GFXMMU cache and prefetch type definition

#endif /* GFXMMU_CR_CE */


#if defined(GFXMMU_CR_ACE)

For more details see HAL GFXMMU address cache type definition

#endif /* GFXMMU_CR_ACE */

For more details see HAL GFXMMU interrupts type definition

Usage example :

HAL1

HAL2

/* Initialize handle */
GFXMMU_HandleTypeDef GfxmmuHandle = {
.Instance = GFXMMU;
/* GFXMMU initialize with cache and prefetch mechanism */

.Init.BlocksPerLine                     =
GFXMMU_256BLOCKS;

.Init.DefaultValue                      =
0x40404040;
.Init.Buffers.Buf0Address               =
0x24000000;
.Init.Buffers.Buf1Address               = 0;
.Init.Buffers.Buf2Address               = 0;
.Init.Buffers.Buf3Address               = 0;
.Init.CachePrefetch.Activation          = ENABLE;
.Init.CachePrefetch.CacheLock           =
GFXMMU_CACHE_LOCK_ENABLE;
.Init.CachePrefetch.CacheLockBuffer     =
GFXMMU_CACHE_LOCK_BUFFER0;
.Init.CachePrefetch.CacheForce          =
GFXMMU_CACHE_FORCE_ENABLE;
.Init.CachePrefetch.OutterBufferability =
GFXMMU_OUTTER_BUFFERABILITY_ENABLE;
.Init.CachePrefetch.OutterCachability   =
GFXMMU_OUTTER_CACHABILITY_ENABLE;
.Init.CachePrefetch.Prefetch            =
GFXMMU_PREFETCH_ENABLE;
.Init.Interrupts.Activation             = ENABLE;
.Init.Interrupts.UsedInterrupts         =
GFXMMU_AHB_MASTER_ERROR_IT;
};
HAL_GFXMMU_Init(&GfxmmuHandle);


/* GFXMMU initialize with address cache mechanism */

.Init.BlocksPerLine                        =
GFXMMU_256BLOCKS;

.Init.DefaultValue                         =
0x40404040;
.Init.Buffers.Buf0Address                  =
0x24000000;
.Init.Buffers.Buf1Address                  = 0;
.Init.Buffers.Buf2Address                  = 0;
.Init.Buffers.Buf3Address                  = 0;
.Init.AddressCache.Activation              = ENABLE;
.Init.AddressCache.AddressCacheLockBuffer  =
 GFXMMU_ADDRESSCACHE_LOCK_BUFFER0;
.Init.Interrupts.Activation                = ENABLE;
.Init.Interrupts.UsedInterrupts            =
GFXMMU_AHB_MASTER_ERROR_IT;
};
HAL_GFXMMU_Init(&GfxmmuHandle);
/* Initialize handle */

 HAL_GFXMMU_Init(&hgfxmmu, HAL_GFXMMU);
 /* GFXMMU configuration with cache and prefetch mechanism*/
 hal_gfxmmu_config_t p_config;
 p_config.blocks_per_line = HAL_GFXMMU_BLOCK_PER_LINE_256;
 HAL_GFXMMU_SetConfig(&hgfxmmu, &p_config);

 HAL_GFXMMU_SetDefaultReturnVal(&hgfxmmu,
                                0x40404040);
 HAL_GFXMMU_SetBuffPhysicalAddr(&hgfxmmu,
                                HAL_GFXMMU_BUFF_0,
                                0x24000000);


 HAL_GFXMMU_EnableCache(&hgfxmmu);


 HAL_GFXMMU_EnableCacheLockBuff(&hgfxmmu,
                                HAL_GFXMMU_BUFF_0);
 HAL_GFXMMU_EnableForceCache(&hgfxmmu);

 hal_gfxmmu_cache_config_t p_config_cache = {
.outer_bufferability = HAL_GFXMMU_OUTER_BUFFERABILITY_ENABLE;
.outer_cachability = HAL_GFXMMU_OUTER_CACHABILITY_ENABLE;
 HAL_GFXMMU_SetConfigCache(&hgfxmmu, &p_config_cache);
 HAL_GFXMMU_EnablePrefetch(&hgfxmmu);

 HAL_GFXMMU_EnableIT(&hgfxmmu,
                     HAL_GFXMMU_IT_AHB_MASTER_ERROR);





 /* GFXMMU configuration with address cache mechanism  */
 hal_gfxmmu_config_t p_config;
 p_config.blocks_per_line = HAL_GFXMMU_BLOCK_PER_LINE_256;
 HAL_GFXMMU_SetConfig(&hgfxmmu, &p_config);

 HAL_GFXMMU_SetDefaultReturnVal(&hgfxmmu,
                                0x40404040);
 HAL_GFXMMU_SetBuffPhysicalAddr(&hgfxmmu,
                                HAL_GFXMMU_BUFF_0,
                                0x24000000);


 HAL_GFXMMU_EnableCache(&hgfxmmu);
 HAL_GFXMMU_EnableCacheLockBuff(&hgfxmmu,
                                HAL_GFXMMU_BUFF_0);

 HAL_GFXMMU_EnableIT(&hgfxmmu,
                     HAL_GFXMMU_IT_AHB_MASTER_ERROR);

HAL GFXMMU interrupts type definition

HAL1

HAL2

In HAL1, the GFXMMU interrupt is a member of the GFXMMU_InitTypeDef structure.

typedef struct
{
   FunctionalState Activation;
   uint32_t        UsedInterrupts;
} GFXMMU_InterruptsTypeDef



Removed : In HAL2, the GFXMMU interrupt is managed by static inline functions in the HAL layer.

void HAL_GFXMMU_EnableIT(hal_gfxmmu_handle_t *hgfxmmu, uint32_t it_source);
void HAL_GFXMMU_DisableIT(hal_gfxmmu_handle_t *hgfxmmu, uint32_t it_source);

Usage example:

/* Interrupts parameters enabled */
GFXMMU_HandleTypeDef GfxmmuHandle = {
.Init.Interrupts.Activation     = ENABLE;
.Init.Interrupts.UsedInterrupts = GFXMMU_BUFFER0_OVERFLOW_IT;
};
HAL_GFXMMU_Init(&GfxmmuHandle);

/* Interrupts parameters disabled */
.Init.Interrupts.Activation  = Disable;
HAL_GFXMMU_Init(&GfxmmuHandle);

Usage example:

/* Interrupts parameters enabled */
 HAL_GFXMMU_EnableIT(&hgfxmmu, HAL_GFXMMU_IT_BUFF0_OVERFLOW);




/* Interrupts parameters disabled */
 HAL_GFXMMU_DisableIT(&hgfxmmu);

HAL GFXMMU LUT line type definition

HAL1

HAL2

In HAL1, GFXMMU_LutLineTypeDef structure is used to configure one line of the LUT with HAL_GFXMMU_ConfigLutLine function.

typedef struct
{
  uint32_t LineNumber;
  uint32_t LineStatus;
  uint32_t FirstVisibleBlock;
  uint32_t LastVisibleBlock;
  uint32_t LineOffset;
} GFXMMU_LutLineTypeDef;
Removed:

In HAL2, this structure is no more available, the user cannot configure one line of the LUT. Now, you can use hal_gfxmmu_lut_config_t structure with HAL_GFXMMU_SetLUT function to configure all lines of the LUT.

For more details, see HAL GFXMMU configure the lookup table (LUT)


HAL GFXMMU callback ID type definition

HAL1

HAL2

typedef enum
{
  HAL_GFXMMU_ERROR_CB_ID,
  HAL_GFXMMU_MSPINIT_CB_ID,
  HAL_GFXMMU_MSPDEINIT_CB_ID,
} HAL_GFXMMU_CallbackIDTypeDef;
  • Removed from HAL2 : the callback registration is managed by dedicated functions for each GFXMMU event. See HAL GFXMMU Callbacks register functions for more details.

  • HAL_GFXMMU_MSPINIT_CB_ID and HAL_GFXMMU_MSPDEINIT_CB_ID are removed because the functions HAL_GFXMMU_MspInit() and HAL_GFXMMU_MspDeInit() are removed.

Related concept:


HAL GFXMMU callback type definition

HAL1

HAL2

pGFXMMU_CallbackTypeDef
hal_gfxmmu_cb_t

Related concept:


HAL GFXMMU state type definition

  • In HAL2, the state machine of the GFXMMU is split into three separate state machines:

    • Global state machine: driver global process

    • Lut state machine : LUT subprocess

    • Buffer state machine: buffer subprocess

HAL1

HAL2

  • Global state

typedef enum
{
  HAL_GFXMMU_STATE_RESET,
  HAL_GFXMMU_STATE_READY,

} HAL_GFXMMU_StateTypeDef;
  • Global state

    typedef enum
    {
      HAL_GFXMMU_STATE_RESET,
      HAL_GFXMMU_STATE_INIT,
      HAL_GFXMMU_STATE_CONFIGURED,
    } hal_gfxmmu_state_t;
    
  • Lut state

    typedef enum
    {
      HAL_GFXMMU_LUT_STATE_RESET,
      HAL_GFXMMU_LUT_STATE_ACTIVE,
    } hal_gfxmmu_lut_state_t;
    
  • Buffer state

    typedef enum
    {
      HAL_GFXMMU_BUFF_STATE_RESET,
      HAL_GFXMMU_BUFF_STATE_CONFIGURED,
    } hal_gfxmmu_buff_state_t;
    

Related concept: